﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Bank_database_system
{
    public partial class 人事首页 : Form
    {
        新建员工a add_emplyinf_a = new 新建员工a();
        查询员工a cha_emplyinf_a = new 查询员工a();
        修改员工a del_emolyinf_a = new 修改员工a();
        int button_state = 0;
        public 人事首页()
        {
            InitializeComponent();
            label4.Text = AccountCheck.name;
            label5.Text = AccountCheck.branchname;
            label8.Text = AccountCheck.staffid;
        }

        private void button7_Click(object sender, EventArgs e)
        {

        }

        private void label3_Click(object sender, EventArgs e)
        {

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            // 更新 TextBox 的文本为当前时间
            label3.Text = "当前时间：" + DateTime.Now.ToString("HH:mm:ss");
        }

        private void 人事首页_Load(object sender, EventArgs e)
        {
            // 启动定时器
            timer1.Start();
            label3.Text = "当前时间：" + DateTime.Now.ToString("HH:mm:ss");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (button_state != 1)
            {

                // 切换按钮图像
                button2.Image = Properties.Resources.新建员工按下;
                button3.Image = Properties.Resources.查询员工;
                button4.Image = Properties.Resources.修改员工;
                //在容器中添加新空间
                panel1.Visible = true;
                panel1.Controls.Clear();
                add_emplyinf_a = new 新建员工a();
                panel1.Controls.Add(add_emplyinf_a);
                button_state = 1;
            }

        }

        private void button3_Click(object sender, EventArgs e)
        {
            if (button_state != 2)
            {

                // 切换按钮图像
                button2.Image = Properties.Resources.新建员工;
                button3.Image = Properties.Resources.查询员工按下;
                button4.Image = Properties.Resources.修改员工;
                //在容器中添加新空间
                panel1.Visible = true;
                panel1.Controls.Clear();
                cha_emplyinf_a = new();
                panel1.Controls.Add(cha_emplyinf_a);
                button_state = 2;
            }

        }

        private void button4_Click(object sender, EventArgs e)
        {
            if (button_state != 3)
            {
                // 切换按钮图像
                button2.Image = Properties.Resources.新建员工;
                button3.Image = Properties.Resources.查询员工;
                button4.Image = Properties.Resources.修改员工按下;
                //在容器中添加新空间
                panel1.Visible = true;
                panel1.Controls.Clear();
                del_emolyinf_a = new();
                panel1.Controls.Add(del_emolyinf_a);

                button_state = 3;
            }

        }

        private void button8_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("是否注销当前账号？", "提示", MessageBoxButtons.OKCancel);
            if (dr == DialogResult.OK)
            {
                //将窗体返回结果设置为Cancel,但并不退出系统
                this.DialogResult = DialogResult.Cancel;
                this.Close();
            }
        }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void label8_Click(object sender, EventArgs e)
        {

        }

        private void button2_mouse_enter(object sender, EventArgs e)
        {
            if (button_state != 1)
            {
                // 鼠标悬停时更改图片
                button2.Image = Properties.Resources.新建员工悬停;
            }
        }

        private void button2_mouse_leave(object sender, EventArgs e)
        {
            if (button_state != 1)
            {
                // 鼠标悬停时更改图片
                button2.Image = Properties.Resources.新建员工;
            }
        }

        private void button3_mouse_enter(object sender, EventArgs e)
        {
            if (button_state != 2)
            {
                // 鼠标悬停时更改图片
                button3.Image = Properties.Resources.查询员工悬停;
            }
        }

        private void button3_mouse_leave(object sender, EventArgs e)
        {
            if (button_state != 2)
            {
                // 鼠标悬停时更改图片
                button3.Image = Properties.Resources.查询员工;
            }
        }
        private void button4_mouse_enter(object sender, EventArgs e)
        {
            if (button_state != 3)
            {
                // 鼠标悬停时更改图片
                button4.Image = Properties.Resources.修改员工悬停;
            }
        }

        private void button4_mouse_leave(object sender, EventArgs e)
        {
            if (button_state != 3)
            {
                // 鼠标悬停时更改图片
                button4.Image = Properties.Resources.修改员工;
            }
        }

        private void pictureBox5_Click(object sender, EventArgs e)
        {

        }
    }
}
